/**
 * 任何数值在数组中出现两次及以上就返回true
 * @param {number[]} nums 
 */
var containDuplicate1 = function (nums) {
    return [...new Set(nums)].toString() === nums.toString() ? false : true
}

var containDuplicate2 = function (nums) {
    const set = new Set()
    for (let i = 0; i < nums.length; i++) {
        if (set.has(nums[i])) {
            return true
        }
        set.add(nums[i])
    }
    return false
}